/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.chipchip.chipchipserver;


import com.chipchip.codec.MessageDecoder;
import com.chipchip.codec.MessageEncoder;
import com.chipchip.controller.MessageController;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.DelimiterBasedFrameDecoder;
import io.netty.handler.codec.Delimiters;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import java.nio.charset.Charset;
import org.apache.commons.lang3.CharUtils;


/**
 *
 * @author Tri
 */
public class CCServerInit extends ChannelInitializer<SocketChannel> {
 
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        // the encoder and decoder are static as these are sharable
        pipeline.addLast("decoder", new MessageDecoder());
        pipeline.addLast("encoder", new MessageEncoder());

        // and then business logic.
        pipeline.addLast("handler", new MessageController());
    }
}
